<?php

require_once 'PHPUnit/Framework/TestCase.php';

/**
 *  test case.
 */
class InitializerTest extends PHPUnit_Framework_TestCase {
	
	/**
	 * Initializer instance
	 * @var unknown_type
	 */
	protected $_initializer;
	
	
	/**
	 * Prepares the environment before running a test.
	 */
	protected function setUp() {
		require_once 'application/Initializer.php';
		$this->_initializer = new Initializer('test');
		parent::setUp ();
		
	}
	
	/**
	 * Cleans up the environment after running a test.
	 */
	protected function tearDown() {		
		parent::tearDown ();
	}
	
	/**
	 * Constructs the test case.
	 */
	public function __construct() {
	}
	
	/**
	 * @expectedException PHPUnit_Framework_Error
	 */
	public function testConfigFileDoesntExist(){
		
		$this->_initializer->setConfigFile('/path/doesnt/exist.xml');		
		if(!@include $this->_initializer->getConfigFile()){
			throw new PHPUnit_Framework_Error();
		}						
		
	}
	
	public function testConfigFileExist(){
		ob_start();
		$assert = @include $this->_initializer->getConfigFile();		
		ob_clean();		
		$this->assertEquals(1,$assert,'Config file exist');		
	}

}

